<?php
namespace Swiftx\Bundle\WeChat\Model\Mall;
use Swiftx\Bundle\WeChat\Interfaces\Common\BaseModel;
use Swiftx\Bundle\WeChat\Model\Seller\Image as SellerImage;

/**
 * 商品图片关联类
 */
class Image extends BaseModel {

    /**
     * 关联商品
     * @var string
     * @orm constraint primary
     * @orm constraint no-null
     * @orm type char(36)
     * @orm column Goods
     */
    protected $goods;

    /**
     * 关联图片
     * @var string
     * @orm constraint primary
     * @orm constraint no-null
     * @orm type char(36)
     * @orm column Company
     */
    protected $image;

    /**
     * 设置关联商品
     * @param string $value
     */
    public function setGoodsID(string $value){
        $this->goods = $value;
    }

    /**
     * 设置关联图片
     * @param string $value
     */
    public function setImage(string $value){
        $this->image = $value;
    }

    /**
     * 获取图片编号
     * @return string
     */
    public function getImageID():string {
        return $this->image;
    }

    /**
     * 获取关联的图片对象
     * @return SellerImage
     */
    public function getImage():SellerImage{
        /** @var SellerImage $result */
        $result = $this->entityManager->fetch(SellerImage::class, $this->getImageID());
        return $result;
    }

}